<%--
 *  File:    ConditionSummary.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.ConditionSummary");
  String strTableName = "ovcondition";
  String strModuleName = "PCM";
  String privilegeCode = "Z0610,L205";
%>



<%

  //get userinfo
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="conditionsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript">

parent.down.location.href = "Blank.jsp?<%= OvalTools.randomURL() %>";

function clickCondition(id,type,orgid)
{
  frm.conditionid.value = id;
  frm.relatedpage.value = type;
  frm.orgid.value = orgid;
  parent.down.location.href = "Blank.jsp?<%= OvalTools.randomURL() %>";
}
function page_delete()
{
	  var id = frm.conditionid.value;
	  if(id == null || id.length == 0 || id == "" || id == "-1")
	    return;
	  var flag = confirm('<%=message.getMessageDesc("ARE_YOU_SURE_DEL")%>');
	  if(!flag)
	    return;
	  frm.actionname.value = "delete";
	  isRunning = true;
	  frm.submit();
}
function page_edit()
{
	  var id = frm.conditionid.value;
	  if(id == null || id.length == 0 || id == "" || id == "-1")
	    return;
	  parent.down.location.href = "ConditionEdit.jsp?<%= OvalTools.randomURL() %>&conditionid=" + id + "&languagecode=<%= strLanguageCode %>";
}
function page_advanced()
{
    var id = frm.conditionid.value;
	  if(id == null || id.length == 0 || id == "" || id == "-1")
	    return;
	  parent.location.href = "AdvancedConditionFrm.jsp?<%= OvalTools.randomURL() %>&conditionid=" + id+"&languagecode=<%= strLanguageCode %>";
	  

}
function page_add()
{
	parent.down.location.href = "ConditionEdit.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>";
}

function page_viewresult()
{
  var id = frm.conditionid.value;
  var type = frm.relatedpage.value;
  var orgid = frm.orgid.value;
  var myurl = type.toString();
  if(isEmpty(myurl)) return;
  myurl += "?conditionid="+id+"&orgid="+orgid+"&languagecode=<%= strLanguageCode %>";
  window.open(myurl, "newwindow", "height=200, width=520,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(frm,actionvalue,orderbyname);
  editform.action = "ConditionSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function downpage(conditionid,head)
{
   parent.location.href = "ConditionDetailMgmtFrm.jsp?<%= OvalTools.randomURL() %>&conditionid=" + conditionid+"&languagecode=<%= strLanguageCode %>";
}
</script>
<%
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);
  cat.debug("The nCurCount is :" + nCurCount);
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);
  cat.debug("The CurUserInfo is :" + CurUserInfo);

  Vector ConditionSummary = (Vector)pageContext.getAttribute("conditionsummary");

  if(ConditionSummary == null)
    ConditionSummary = new Vector();
%>
</head>

<body>
<table width="100%" cellspacing="0">
 <form name="frm" method="post" action="../../Dispatcher"  target="_parent">
   <input type="hidden" name="pagename" value="conditionsummary">
	 <input type="hidden" name="actionname">
	 <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

   <input type="hidden" name="validonly" >

 <table width="100%" cellspacing="0">
   <% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
</table>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
 <tr>
    <td>
       <table width="100%" border="0" cellspacing="0">
         <%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>



  <tr>
    <td>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">

        <tr class="deepblue-left">
          <td width="22" class="title_center">&nbsp;</td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','conditioncode')"><%= label.getLabelName("L_ConditionCode") %></a></td>
          <td class="title_center"><a href="javascript:page_summary('orderby','conditiondesc')"><%= label.getLabelName("L_ConditionDesc") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','conditiontypename')"><%= label.getLabelName("L_Category") %></a></td>
          <td width="50" class="title_center"><a href="javascript:page_summary('orderby','statusname')"><%= label.getLabelName("L_Status") %></a></td>
          <td class="title_center" width="80"><a href="javascript:page_summary('orderby','datelastupdated')"><%= label.getLabelName("L_DateLastUpdated") %></a></td>
        </tr>
        <%
             int j = 0;
             String strClassType = new String();
             Integer nDefaultId = new Integer(-1);
             String strDetaultPage = "";
             Integer nDefaultOrgId = new Integer(-1);
             boolean bHasChecked = false;
          %>
          <logic:iterate id="condition" collection="<%= ConditionSummary %>">
         <%
            HashMap ConditionMap = (HashMap)pageContext.getAttribute("condition");

            String strIsDisabled = new String("");
            String strIsChecked = new String("");

            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }
           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              bHasChecked = true;
              nDefaultId = (Integer)(ConditionMap.get("conditionid"));
              strDetaultPage = (String)(ConditionMap.get("relatedpage"));
              nDefaultOrgId = (Integer)(ConditionMap.get("orgid"));
            }
            j++;
          %>

           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('proline<%=JspHelper.filterNull(j)%>');clickCondition('<%=JspHelper.filterNull( ConditionMap.get("conditionid") )%>','<%=JspHelper.filterNull( ConditionMap.get("relatedpage") )%>','<%=JspHelper.filterNull( ConditionMap.get("orgid") )%>')" class="<%=JspHelper.filterNull(strClassType)%>">
            <td width="5%">
              <input id="proline<%=JspHelper.filterNull(j)%>" type="radio" name="checkdept"  value=<%=JspHelper.filterNull( ConditionMap.get("conditionid") )%> class="checkbox" <%=JspHelper.filterNull( strIsChecked)%> onClick="javascript:clickCondition('<%=JspHelper.filterNull( ConditionMap.get("conditionid") )%>','<%=JspHelper.filterNull( ConditionMap.get("relatedpage") )%>','<%=JspHelper.filterNull( ConditionMap.get("orgid") )%>')">
            </td>
            <td>&nbsp;<a href="javascript:downpage('<%=JspHelper.filterNull( ConditionMap.get("conditionid") )%>','<%= OvalTools.replaceQuot((String)ConditionMap.get("conditioncode")+ (String)ConditionMap.get("conditiondesc"))%>')"><%=JspHelper.filterNull( ConditionMap.get("conditioncode") )%></a></td>
            <td>&nbsp;<%=JspHelper.filterNull( ConditionMap.get("conditiondesc") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ConditionMap.get("conditiontypename") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ConditionMap.get("statusname") )%></td>
            <td>&nbsp;<%= OvalTools.dateToString(ConditionMap.get("datelastupdated"),(String)session.getAttribute("dateformat")) %></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="conditionid" value="<%=JspHelper.filterNull( nDefaultId )%>">
          <input type="hidden" name="relatedpage" value="<%=JspHelper.filterNull( strDetaultPage )%>">
          <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( nDefaultOrgId )%>">

			    <% //--------------------------------------  flipping page --%>
			    <%@ include file="/inc/SummaryAction.inc" %>


      </form>
	  </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top"></td>
        </tr>
        <tr>
          <td class="td_center">
          <a onclick="page_add()"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>&nbsp;
          <a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>&nbsp;
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>&nbsp;
          <a onclick="page_viewresult()"><custom:button type="1" label="L_Viewresult" imgsrc="Viewresult.gif" border="0" style="width:60"/></a>
          <a onclick="page_advanced()"><custom:button type="1" label="L_AdvancedCond" imgsrc="AdvancedCond.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
 </table>
</table>
</body>
</html>


